home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / fviewsrc.zip / ARC_VIEW.C < prev    next >
C/C++ Source or Header  |  1993-01-04  |  21KB  |  610 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /* Copyright 1989, Doug Boone.  FidoNet 119/5                               */
  4. /*                              (916) 893-9019 Data                         */
  5. /*                              (916) 891-0748 voice                        */
  6. /*                              P.O. Box 5108, Chico, CA. 95928             */
  7. /*                                                                          */
  8. /* This program is not for sale. It is for the free use with Opus systems.  */
  9. /* You may not sell it in ANY way. If you have an access charge to your     */
  10. /* Bulletin Board, consider this to be like Opus, you can ONLY make it      */
  11. /* available for download in an open area, where non-members can get access */
  12. /*                                                                          */
  13. /* If you need to modify this source code, please send me a copy of the     */
  14. /* changes you've made so that everyone can share in the updates.           */
  15. /*                                                                          */
  16. /* "Don't rip me off!" -- Tom Jennings, FidoNet's founder                   */
  17. /*                                                                          */
  18. /*--------------------------------------------------------------------------*/
  19.  
  20. #include    <stdio.h>
  21. #include    <string.h>
  22. #include    <ctype.h>
  23. #include    <time.h>
  24. #include    <signal.h>
  25. #include    <dos.h>
  26. #ifdef TURBOC
  27. #include    <dir.h>
  28. #include    <alloc.h>
  29. #else
  30. #include    <malloc.h>
  31. #endif
  32. #include    <io.h>
  33. #include    <fcntl.h>
  34. #include    <dos.h>
  35. #include    <conio.h>
  36. #include    <sys\types.h>
  37. #include    <sys\stat.h>
  38. #include    <opus.h>
  39. #include    <process.h>
  40. #include    "archdr.h"
  41. #include    "arc_view.h"
  42.  
  43. /* ====================================================================
  44.  * start a new screen full while listing the contents of an arc file
  45.  * ====================================================================
  46.  */
  47. void arc_header(char *packer,char *name)
  48.  
  49. {
  50.     char    temp[80];
  51.     char    *check;
  52.  
  53.     if (!ctrl_err)
  54.         return;
  55.  
  56.     if ((check = strchr(name,'\\')) != NULL)
  57.         check++;
  58.     else
  59.         check =name;
  60.     sprintf(temp,"\n %s  Contents of %s\n",packer,check);
  61.     sdisplay(temp);
  62.     sdisplay("Filename        Length   Method     Size   Ratio    Date      Time\n");
  63.     sdisplay("--------        ------   ------    ------  -----    ----      ----\n");
  64.     return;
  65. }
  66.  
  67. /*--------------------------------------------------------------------------*/
  68. /* Print out one line of archives                                           */
  69. /*--------------------------------------------------------------------------*/
  70.  
  71. void one_line(char *name,long org_len,long new_len,char *pack,char *date,char *time)
  72. {
  73.     int     factor;
  74.     char    temp[80];
  75.  
  76.     if (!ctrl_err)
  77.         return;
  78.  
  79.     if (new_len > 0)
  80.         factor = (100 * new_len)/org_len;
  81.     if (strlen(name) < 13)
  82.         sprintf(temp,"%-12s",name);
  83.     else
  84.         sprintf(temp,"%s\n            ",name);
  85.     sdisplay(temp);
  86.  
  87.     sprintf(temp,"  %8ld %10s%8ld   %3d%%",org_len,pack,new_len,factor);
  88.     sdisplay(temp);
  89.     sprintf(temp,"  %8s  %8s\n",date,time);
  90.     sdisplay(temp);
  91.     return;
  92. }
  93. /*--------------------------------------------------------------------------*/
  94. /* Show grand totals for successful archives                                */
  95. /*--------------------------------------------------------------------------*/
  96.  
  97. void do_totals(int totmbrs,long totlen,long totsize,int totsf)
  98. {
  99.     char    temp[81];
  100.  
  101.     if (!ctrl_err)
  102.         return;
  103.  
  104.     sdisplay("----\t\t------\t\t   ------  -----\n");
  105.     sprintf(temp,"Total %6d  %8ld  ",totmbrs,totlen);
  106.     sdisplay(temp);
  107.     sprintf(temp,"\t %8ld   %3d%%\n",totsize,totsf);
  108.     sdisplay(temp);
  109.     return;
  110. }
  111.  
  112. /* ====================================================================
  113.  * start of list arc contents processing
  114.  * ====================================================================
  115.  */
  116. int lstarc(char *arcname)        /* list files in archive */
  117. {
  118.     struct     heads *hdr;        /* header data */
  119.     int     totmbrs;        /* total members in arc */
  120.     long    totlen;            /* total of file lengths */
  121.     long    totsize;        /* total of file sizes */
  122.     long    totsf;
  123.     int        ver;
  124.     FILE      *arc;            /* archive file */
  125.     char    date[9];
  126.     char    time[9];
  127.     char    method[11];
  128.  
  129.     totmbrs = totlen = totsize = 0L;    /* reset totals */
  130.  
  131.     hdr = (struct heads *) malloc(sizeof(struct heads));
  132.  
  133.     if((arc=fopen(arcname,"rb")) == NULL ) {
  134.         perror("  Cannot read archive: ");
  135.         return(-1);
  136.         }
  137.     mem_used = 0;
  138.     fseek(arc,1L,SEEK_SET);
  139.     ver = fgetc(arc);
  140.     if (!(flags & VIEW))
  141.         arc_header("ARC/PAK",arcname);
  142.     while (ver > 0 && ver < 11) {
  143.         fread(hdr,sizeof(struct heads),1,arc);
  144.         if (!(flags & VIEW)) {
  145.             totlen += hdr->mbrlen;
  146.             totsize += hdr->mbrsize;
  147.             totmbrs++;
  148.             sprintf(date,"%02d-%02d-%02d",
  149.                 ((hdr->mbrdate >> MONTH_SHIFT) & MONTH_MASK),
  150.                     (hdr->mbrdate & DAY_MASK),
  151.                         ((hdr->mbrdate >> YEAR_SHIFT) + DOS_EPOCH));
  152.  
  153.             sprintf(time,"%02d:%02d:%02d",
  154.                 ((hdr->mbrtime >> HOUR_SHIFT) & HOUR_MASK),
  155.                 ((hdr->mbrtime >> MINUTE_SHIFT) & MINUTE_MASK),
  156.                     (hdr->mbrtime & HOUR_MASK)*2);
  157.             switch(ver) {
  158.                 case 1:    strcpy(method,"    --    ");    /* 1 - old, no compression */
  159.                         break;
  160.                 case 2: strcpy(method,"  Stored  ");    /* 2 - new, no compression */
  161.                         break;
  162.                 case 3: strcpy(method,"  Packed  ");    /* 3 - dle for repeat chars */
  163.                         break;
  164.                 case 4: strcpy(method," Squeezed ");    /* 4 - huffman encodeing */
  165.                         break;
  166.                 case 5: strcpy(method," Crunched ");    /* 5 - lz, no dle */
  167.                         break;
  168.                 case 6: strcpy(method," Crunched ");    /* 6 - lz with dle */
  169.                         break;
  170.                 case 7: strcpy(method," Crunched ");    /* 7 - lz with readjust */
  171.                         break;
  172.                 case 8: strcpy(method," Crunched ");    /* 8 - lz with readjust and dle */
  173.                         break;
  174.                 case 9: strcpy(method," Squashed ");    /* 9 - modified lzw, no dle */
  175.                         break;
  176.                 case 10: strcpy(method,"  Crushed ");    /* PAK's new method */
  177.                             break;
  178.                 default: strcpy(method," Unknown! ");/* future? */
  179.                         break;
  180.                 }        /* End of version switch */
  181.             one_line(hdr->mbrname,hdr->mbrlen,hdr->mbrsize,method,date,time);
  182.             }
  183.         strcpy(member[mem_used].name,hdr->mbrname);
  184.         member[mem_used].size = ((unsigned int) hdr->mbrsize/1024L);
  185.         if (mem_used < MAX_NAMES)
  186.             mem_used++;
  187.         fseek(arc,hdr->mbrsize+1L,SEEK_CUR);
  188.         ver = fgetc(arc);
  189.         if (!(ctrl_err))
  190.             ver = 0;
  191.         };        /* End of while loop */
  192.     fclose(arc);        /* then close it */
  193.     if (!(flags & VIEW)) {
  194.         totsf = 0L;
  195.         if(totlen>0L)
  196.             totsf = (int)(100L - ((100L*totsize)/totlen));
  197.         do_totals(totmbrs,totlen,totsize,totsf);
  198.         }
  199.     free(hdr);
  200.     if (mem_used >0) {
  201.         mem_used--;
  202.         if (ctrl_err)
  203.             return(0);
  204.         }
  205.     return(-1);
  206. }
  207.  
  208. /*--------------------------------------------------------------------------*/
  209. /* Handle a ZOO archive                                                     */
  210. /*--------------------------------------------------------------------------*/
  211.  
  212. int do_zoo(char *filename)
  213. {
  214.     FILE    *fhandle;
  215.     struct    zoo_header    *main_head;
  216.     struct    direntry    *one_head;
  217.     int     result;
  218.     unsigned    totmbrs=0;        /* number of members in Zoo */
  219.     long    totlen=0L;        /* total of all file sizes */
  220.     long    totsize = 0L;
  221.     int     totsf;
  222.     char    method[11];
  223.     char    time[9];
  224.     char    date[9];
  225.  
  226.     main_head = (struct zoo_header *) malloc(sizeof(struct zoo_header));
  227.     one_head = (struct direntry *) malloc(sizeof(struct direntry));
  228.  
  229.     fhandle = fopen(filename,"rb");
  230.     result = fread(main_head,sizeof(struct zoo_header),1,fhandle);
  231.     if ((strnicmp(main_head->text,"ZOO",3)) != 0) {
  232.         sdisplay("  Not a Zoo archive!  ");
  233.         fclose(fhandle);
  234.         return(-1);
  235.         }
  236.     mem_used = 0;
  237.     if (!(flags & VIEW))
  238.         arc_header("ZOO",filename);
  239.     fseek(fhandle,main_head->zoo_start,SEEK_SET);
  240.     result = fread(one_head,sizeof(struct direntry),1,fhandle);
  241.     do {
  242.         if (result == 1) {
  243.             if (!(flags & VIEW)) {
  244.                 totmbrs++;
  245.                 totsize += one_head->org_size;
  246.                 totlen += one_head->size_now;
  247.                 switch(one_head->packing_method) {
  248.                     case 0:
  249.                                 strcpy(method,"  Stored  ");
  250.                                 break;
  251.                     case 1:
  252.                                 strcpy(method," Norm LZW ");
  253.                                 break;
  254.                     default:
  255.                                 strcpy(method,"  Unknown ");
  256.                                 break;
  257.                     }
  258.                 sprintf(date,"%02d-%02d-%02d",
  259.                     ((one_head->date >> MONTH_SHIFT) & MONTH_MASK),
  260.                         (one_head->date & DAY_MASK),
  261.                             ((one_head->date >> YEAR_SHIFT) + DOS_EPOCH));
  262.  
  263.                 sprintf(time,"%02d:%02d:%02d",
  264.                     ((one_head->time >> HOUR_SHIFT) & HOUR_MASK),
  265.                     ((one_head->time >> MINUTE_SHIFT) & MINUTE_MASK),
  266.                         (one_head->time & HOUR_MASK)*2);
  267.                 one_line(one_head->fname,one_head->org_size,one_head->size_now,
  268.                     method,date,time);
  269.                 }
  270.             strcpy(member[mem_used].name,one_head->fname);
  271.             member[mem_used].size = ((unsigned int) one_head->org_size/1024L);
  272.             if (mem_used < MAX_NAMES)
  273.                 mem_used++;
  274.             fseek(fhandle,one_head->next,SEEK_SET);
  275.             }
  276.         result = fread(one_head,sizeof(struct direntry),1,fhandle);
  277.         if (!(ctrl_err))
  278.             result = 0;
  279.         } while ((one_head->offset != 0L) &&
  280.             (result == 1));
  281.     free(one_head);
  282.     free(main_head);
  283.     if (mem_used > 0)
  284.         mem_used--;
  285.     result = fclose(fhandle);
  286.     if (!(flags & VIEW)) {
  287.         if (totlen>0)
  288.             totsf=(int)(100L - ((100L*totlen)/totsize));
  289.         else
  290.             totsf = 0;
  291.         do_totals(totmbrs,totlen,totsize,totsf);
  292.         }
  293.     return(0);
  294. }
  295.  
  296. /*--------------------------------------------------------------------------*/
  297. /* Read a DWC archive. These are the hardest ones to get into.              */
  298. /*--------------------------------------------------------------------------*/
  299.  
  300. int read_dwc(char *name)
  301. {
  302.     long    size;
  303.     int        infile;
  304.     unsigned    int        result;
  305.     struct    dwc_entry    *one_entry;
  306.     struct    dwc_arc    *one_archive;
  307.     struct  tm *t;
  308.     char    junkbuffer[256];
  309.     char    *dwc;
  310.     unsigned int    junkoffset;
  311.     int        count;  /* total number of files in this archive */
  312.     long    totsize = 0L;
  313.     long    totlen = 0L;
  314.     int     totmbrs = 0;
  315.     int     totsf;
  316.     char    date[9];
  317.     char    time[9];
  318.     char    method[11];
  319.  
  320.     if((infile = open(name,O_BINARY|O_RDONLY)) < 0) {
  321.         sprintf(junkbuffer,"Couldn't open file %s\n",name);
  322.         sdisplay(junkbuffer);
  323.         return(-1);
  324.         }
  325.     one_entry = (struct dwc_entry *) malloc(sizeof(struct dwc_entry));
  326.     one_archive = (struct dwc_arc *) malloc(sizeof(struct dwc_arc));
  327.     count = 0;
  328.     mem_used = 0;
  329.     do {
  330.         totlen = (long) (++count * sizeof(junkbuffer));
  331.         size = lseek(infile,-totlen,SEEK_END);
  332.         if (size > 0L)
  333.             result = read(infile,junkbuffer,sizeof(junkbuffer));
  334.         else result = 0;
  335.         } while ((count < 20) && (result == sizeof(junkbuffer)) &&
  336.             ((dwc = memrstr(junkbuffer,"DWC",result)) == NULL));
  337.  
  338.     if ((result < sizeof(junkbuffer)) ||
  339.         (count > 19)) { /* Failed to find "DWC", not DWC file */
  340.         close (infile);
  341.         free(one_archive);
  342.         free(one_entry);
  343.         return(-1);
  344.         }
  345.     junkoffset = count * sizeof(junkbuffer)  /* start of this buffer block */
  346.         - (dwc-junkbuffer)  /* minus the offset to the "DWC" in the buffer */
  347.         + sizeof(struct dwc_arc) - 3;
  348.     size = lseek (infile,-(long)junkoffset,SEEK_END);
  349.     result = read(infile,(void *) one_archive,sizeof(struct dwc_arc));
  350.     if (one_archive->size != sizeof(struct dwc_arc)) {
  351.         close(infile);
  352.         free(one_archive);
  353.         free(one_entry);
  354.         return(-1);
  355.         }
  356.     if (!(flags & VIEW))
  357.         arc_header("DWC",name);
  358.     count = (int) one_archive->entries;
  359.     totmbrs = count;
  360.     totlen = 0L;
  361.     size = lseek(infile,-(long)(count*one_archive->ent_sz+junkoffset),SEEK_END);
  362.     while (count>0) {
  363.         result = read(infile,(void *) one_entry,sizeof(struct dwc_entry));
  364.         totsize += one_entry->size;
  365.         totlen += one_entry->new_size;
  366.         switch(one_entry->method) {
  367.             case 0:
  368.                         strcpy(method,"  Stored  ");
  369.                         break;
  370.             case 1:
  371.                         strcpy(method," Norm LZW ");
  372.                         break;
  373.             default:
  374.                         strcpy(method,"  Unknown ");
  375.                         break;
  376.             }
  377.         totsf = 0;
  378.         t = localtime(&one_entry->time);
  379.         sprintf(time,"%02d-%02d-%02d",
  380.             (t->tm_mon+1),t->tm_mday,t->tm_year);
  381.  
  382.         sprintf(date,"%02d:%02d:%02d",
  383.             t->tm_hour,t->tm_min,t->tm_sec);
  384.  
  385.         strcpy(member[mem_used].name,one_entry->name);
  386.         member[mem_used].size = ((unsigned int) one_entry->size/1024L);
  387.         if (!(flags & VIEW))
  388.             one_line(one_entry->name,one_entry->size,one_entry->new_size,
  389.                 method,time,date);
  390.         count--;
  391.         if (!(ctrl_err))
  392.             count = 0;
  393.         if (mem_used < MAX_NAMES)
  394.             mem_used++;
  395.         };
  396.     close (infile);
  397.     free(one_archive);
  398.     free(one_entry);
  399.     if (mem_used > 0)
  400.         mem_used--;
  401.     if (!(flags & VIEW)) {
  402.         if (totlen>0)
  403.             totsf=(int)(100L - ((100L*totlen)/totsize));
  404.         else
  405.             totsf = 0;
  406.         do_totals(totmbrs,totlen,totsize,totsf);
  407.         }
  408.     return(0);
  409. }
  410.  
  411. /*--------------------------------------------------------------------------*/
  412. /* memrstr searches backwards through a chunk of memory called "buffer"     */
  413. /* that is "buflen" long, looking for a string "target". The search is from */
  414. /* the end of "buffer" forward. It returns a pointer to the start of the    */
  415. /* target string                                                            */
  416. /*--------------------------------------------------------------------------*/
  417.  
  418. char *memrstr(char *buffer,char *target,int buflen)
  419. {
  420.  
  421.     char    c = ' ';
  422.     char    *ptr;
  423.     int        found = 1;
  424.  
  425.     c = target[strlen(target)-1];
  426.     ptr = buffer+buflen;
  427.     do {
  428.         if (c != *ptr)
  429.             ptr--;
  430.         else {
  431.             ptr -= strlen(target)-1;
  432.             found = strnicmp(target,ptr,sizeof(target));
  433.             if (found != 0)
  434.                 ptr += strlen(target) - 2;
  435.             }
  436.         if (ptr < buffer)
  437.             ptr = NULL;
  438.         } while (found !=0 && ptr != NULL);
  439.     return(ptr);
  440. }
  441.  
  442. /*--------------------------------------------------------------------------*/
  443. /* Do ZIP Archives                                                          */
  444. /*--------------------------------------------------------------------------*/
  445.  
  446. do_zip(char *name)
  447. {
  448.     struct  ID_Hdr          *ID;
  449.     struct  Local_Hdr       *local;
  450.     char    *mbrname;
  451.     long    totsize = 0L;
  452.     long    totlen = 0L;
  453.     int     totmbrs = 0;
  454.     int     totsf;
  455.     char    date[9];
  456.     char    time[9];
  457.     char    method[11];
  458.     int     handle;
  459.     int        check;
  460.  
  461.     ID = (struct ID_Hdr *) malloc(sizeof(struct ID_Hdr));
  462.     local = (struct Local_Hdr *) malloc(sizeof(struct Local_Hdr));
  463.     mbrname = (char *) malloc(80);
  464.  
  465.     if (!(flags & VIEW))
  466.         arc_header("ZIP",name);
  467.     mem_used = 0;
  468.     handle = open(name,O_BINARY|O_RDONLY);
  469.     do {
  470.         check = read(handle,(void *)ID,sizeof(struct ID_Hdr));
  471.         if (ID->Head_Type == LOCAL_HEADER) {
  472.             if ((check = read(handle,(void *)local,sizeof(struct Local_Hdr))) != -1) {
  473.                 if (!(flags & VIEW)) {
  474.                     sprintf(date,"%02d-%02d-%02d",
  475.                         ((local->mod_date >> MONTH_SHIFT) & MONTH_MASK),
  476.                             (local->mod_date & DAY_MASK),
  477.                                 ((local->mod_date >> YEAR_SHIFT) + DOS_EPOCH));
  478.  
  479.                     sprintf(time,"%02d:%02d:%02d",
  480.                         ((local->mod_time >> HOUR_SHIFT) & HOUR_MASK),
  481.                         ((local->mod_time >> MINUTE_SHIFT) & MINUTE_MASK),
  482.                             (local->mod_time & HOUR_MASK)*2);
  483.  
  484.                     switch(local->compression) {
  485.                         case 0: strcpy(method,"  Stored  ");    break;
  486.                         case 1: strcpy(method,"  Shrunk  ");    break;
  487.                         case 2: strcpy(method," Reduce(1)");    break;
  488.                         case 3: strcpy(method," Reduce(2)");    break;
  489.                         case 4: strcpy(method," Reduce(3)");    break;
  490.                         case 5: strcpy(method," Reduce(4)");    break;
  491.                         }
  492.                     totsize += local->size_now;
  493.                     totlen += local->real_size;
  494.                     totmbrs++;
  495.                     }
  496.                 memset(mbrname,EOS,80);
  497.                 check = read(handle,mbrname,local->name_length);
  498.                 strcpy(member[mem_used].name,mbrname);
  499.                 member[mem_used].size = ((unsigned int) local->real_size/1024L);
  500.                 if (!(flags & VIEW))
  501.                     one_line(mbrname,local->real_size,local->size_now,method,date,time);
  502.                 lseek(handle,local->size_now,SEEK_CUR);
  503.                 if (!(ctrl_err))
  504.                     check = 0;
  505.                 if (mem_used < MAX_NAMES)
  506.                     mem_used++;
  507.                 }        /* End of one entry */
  508.             }        /* End of grabbing local directory entries */
  509.         else
  510.             check = -1;
  511.         } while(check >0 && !eof(handle));        /* End of file */
  512.     if (mem_used > 0) {
  513.         mem_used--;
  514.         check = 0;
  515.         }
  516.     if (!(flags & VIEW)) {
  517.         if (totsize>0)
  518.             totsf=(int)(100L - ((100L*totsize)/totlen));
  519.         else
  520.             totsf = 0;
  521.         do_totals(totmbrs,totlen,totsize,totsf);
  522.         }
  523.     close(handle);
  524.     free(local);
  525.     free(mbrname);
  526.     free(ID);
  527.     return(check);
  528. }
  529.  
  530. /*--------------------------------------------------------------------------*/
  531. /* Do LZH (LHARC) files                                                     */
  532. /*--------------------------------------------------------------------------*/
  533.  
  534. int read_lzh(char *name)
  535. {
  536.     struct  Lharc_Hdr   *local;
  537.     long    totsize = 0L;
  538.     long    totlen = 0L;
  539.     int     totmbr = 0;
  540.     int     totsf;
  541.     char    date[9];
  542.     char    time[9];
  543.     char    method[11];
  544.     char    *mbrname;
  545.     int     handle;
  546.     int        check;
  547.  
  548.     local = (struct Lharc_Hdr *) malloc(sizeof(struct Lharc_Hdr));
  549.     mbrname = (char *) malloc(80);
  550.  
  551.     handle = open(name,O_BINARY|O_RDONLY);
  552.  
  553.     if ((check = read(handle,(void *)local,sizeof(struct Lharc_Hdr))) ==
  554.         sizeof(struct Lharc_Hdr)) {
  555.             if (!((strncmp(local->type,"-lh",3) == 0) &&
  556.                 (local->type[4] == '-'))) {
  557.                 close(handle);
  558.                 free(local);
  559.                 free(mbrname);
  560.                 return(-1);
  561.                 }
  562.             }
  563.     else {
  564.         close(handle);
  565.         free(local);
  566.         free(mbrname);
  567.         return(-1);
  568.         }
  569.     arc_header("LHARC",name);
  570.  
  571.     do {
  572.         sprintf(date,"%02d-%02d-%02d",
  573.             ((local->date >> MONTH_SHIFT) & MONTH_MASK),
  574.                 (local->date & DAY_MASK),
  575.                     ((local->date >> YEAR_SHIFT) + DOS_EPOCH));
  576.  
  577.         sprintf(time,"%02d:%02d:%02d",
  578.             ((local->time >> HOUR_SHIFT) & HOUR_MASK),
  579.             ((local->time >> MINUTE_SHIFT) & MINUTE_MASK),
  580.                 (local->time & HOUR_MASK)*2);
  581.         strcpy(method,"  ");
  582.         strcat(method,local->type);
  583.         method[7] = EOS;
  584.         strcat(method,"  ");
  585.  
  586.         memset(mbrname,EOS,80);
  587.         check = read(handle,mbrname,local->name_len);
  588.  
  589.         totsize += local->size_now;
  590.         totlen += local->orig_size;
  591.         totmbr++;
  592.         one_line(mbrname,local->orig_size,local->size_now,method,date,time);
  593.         lseek(handle,local->size_now + 2L,SEEK_CUR);
  594.         check = read(handle,(void *)local,sizeof(struct Lharc_Hdr));
  595.         } while(check >1 && !eof(handle));        /* End of file */
  596.     close(handle);
  597.     if (totsize>0)
  598.         totsf=(int)(100L - ((100L*totsize)/totlen));
  599.     else
  600.         totsf = 0;
  601.     printf("----\t\t------\t\t   ------  -----\n");
  602.     printf("Total %6d  %8ld  ",totmbr,totlen);
  603.     printf("\t %8ld   %3d%%\n",totsize,totsf);
  604.     free(local);
  605.     free(mbrname);
  606.     return(0);
  607. }
  608.  
  609.  
  610.